home *** CD-ROM | disk | FTP | other *** search
/ Acorn Risc Technologies StrongARM CD-ROM / Acorn Risc Technologies StrongARM CD-ROM.iso / ftp / documents / appnotes / 001_015 / 007c / Text
Encoding:
Text File  |  1993-08-02  |  12.4 KB  |  306 lines

  1. -----------------------------------------------------------------------------
  2. 16th June 1992
  3. -----------------------------------------------------------------------------
  4. Support Group Application Note
  5. Number: 007
  6. Issue: 1
  7. Author:
  8. -----------------------------------------------------------------------------
  9.  
  10. Z80 Second Processor Application Note
  11.  
  12. -----------------------------------------------------------------------------
  13. Applicable Hardware: BBC B
  14.                      BBC B+
  15.                      BBC Master 128
  16.  
  17. Related Application Notes:Z80 User Guide Errata
  18.  
  19.  
  20. -----------------------------------------------------------------------------
  21. Copyright (C) Acorn Computers Limited 1992
  22.  
  23. Every effort has been made to ensure that the information in this leaflet is 
  24. true and correct at the time of printing. However, the products described in
  25. this leaflet are subject to continuous development and improvements and
  26. Acorn Computers Limited reserves the right to change its specifications at
  27. any time. Acorn Computers Limited cannot accept liability for any loss or
  28. damage arising from the use of any information or particulars in this
  29. leaflet. ACORN, ECONET and ARCHIMEDES are trademarks of Acorn Computers
  30. Limited.
  31. -----------------------------------------------------------------------------
  32. Support Group
  33. Acorn Computers Limited
  34. Acorn House
  35. Vision Park
  36. Histon
  37. Cambridge       CB4 4AE
  38. -----------------------------------------------------------------------------
  39.  
  40. CP/M OPERATING SYSTEM TECHNICAL NOTES
  41.  
  42.  
  43. Z80 Monitor
  44.  
  45. After turning on the Z80 and pressing BREAK the following display appears:
  46.  
  47.         Acorn TUBE Z80 64K n.nn
  48.         Acorn DFS
  49.         BASIC
  50.         *
  51.  
  52. where n.nn is the version number of the Z80 ROM.  The * prompt indicates
  53. that the Z80 Monitor is running and at this stage all the standard *
  54. commands can be entered ie *HELP, *FX4 etc.  The Z80 Monitor will also
  55. recognise the following additional commands which allow memory to be
  56. examined and changed and small machine code programs to be entered directly
  57. and tested.
  58.  
  59.         CPM
  60.         D <start address> <end address>
  61.         GO <address>
  62.         S <start address>
  63.  
  64. In the above commands address refers to a hexadecimal address which can be
  65. entered as 1 to 4 digits ie 3F can be entered as 3F, 03F or 003F.  If more
  66. than 4 hex digits are entered the most significant digits will truncated ie
  67. 12345 will be treated as 2345.  If not address is specified the most
  68. recently specified address will be used instead.  For all commands any
  69. leading spaces or asterisks and trailing spaces will be ignored.
  70.  
  71. The extra commands are now explained in more detail:-
  72.  
  73. CPM - this command allows the CP/M system to be loaded without resetting any
  74. previously entered * commands which would occur if CP/M was loaded using
  75. CNTRL BREAK.  ie typing 
  76.         *KEY0|M
  77.         *KEY1 STAT *.*|M
  78.         *KEY2 ERA
  79.         *CPM
  80.  
  81. would allow the function keys to be defined before starting up CP/M (These
  82. key definitions would have been reset if CNTRL BREAK had been used to load
  83. CP/M).
  84.  
  85. D (Dump) - this command gives a memory dump with character interpretation
  86. between the two specified addresses.  At least one space is expected between
  87. the start and end addresses but no space is necessary before the first
  88. address.  A dump can be terminated at any time by pressing ESCAPE.
  89.  
  90. GO - This command causes a jump to occur to the specified address.
  91.  
  92. S (Set) - This command allows memory to be examined and altered from the
  93. specified start address.  No space is needed between the command and the
  94. address.  The displayed memory location can be altered by entering valid hex
  95. digits which are shifted in from the right.  the command can be terminated
  96. by entering any non hex character.  To alter more than one location the UP
  97. and DOWN cursor keys can be used to increment or decrement the memory
  98. location.
  99.  
  100. Z80 OSWORD CALL
  101.  
  102. The Z80 provides an additional OSWORD call with A = 0FFH to read or write
  103. blocks of I/O processor memory.  On entry HL point to the following control
  104. block:-
  105.  
  106.         HL + 0  Number of OSWORD parameters sent to I/O processor - 0DH
  107.         HL + 1  Number of OSWORD parameters read from I/O processor - 01H
  108.         HL + 2  LSB of I/O processor address
  109.         HL + 3
  110.         HL + 4
  111.         HL + 5  MSB of I/O processor address
  112.         HL + 6  LSB of Z80 processor address
  113.         HL +7   
  114.         HL + 8
  115.         HL + 9  MSB of Z80 processor address
  116.         HL + A  LSB of number of bytes to read/write
  117.         HL + B  MSB of number of bytes to read/write
  118.         HL + C  Operation type - 0 to write to I/O processor
  119.                             1 to read from I/O processor
  120.  
  121. The first two bytes are used by the Z80 OS and must not be changed.  If the
  122. I/O processor uses 16 bit addresses only the first two least significant
  123. bytes need to be specified.
  124.  
  125. An example of the use of this call is now given:-
  126.  
  127. To read I/O processor screen memory (mode 0) into Z80 memory at 08000H
  128.  
  129.         LD      A,0FFH  ;OSWORD call 0FFH
  130.         LD      HL,BLOCK        ;Set up HL to pint to control block
  131.         CALL    0FFF1H
  132. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  133.  
  134. BLOCK:  DEFB    0DH
  135.         DEFB    01H
  136.         DEFW    03000H  ;start of screen memory in i/o processor
  137.         DEFW    0       ;set high word to zero
  138.         DEFW    08000H  ;start of transfer address in Z80
  139.         DEFW    0       
  140.         DEFW    05000H  ;size of screen memory (20K)
  141.         DEFB    1       ;read operation
  142.  
  143.  
  144. I/O Processor Memory Usage
  145.  
  146. The following areas of I/O processor memory are reserved and should not be
  147. corrupted by any user programs
  148.  
  149. 2500H - 25FFH   Reserved for use by Z80 OS
  150. 2600H - 2FFFH   Reserved for use by CP/M
  151.  
  152.  
  153. CP/M Disc Format
  154.  
  155. Acorn CP/M uses the following double sided disc format:-
  156.  
  157.         80 tracks / surface
  158.         10 sectors / track
  159.         256 bytes / sector
  160.  
  161. A double sided disc is regarded by CP/M as a single logical disc with 160
  162. tracks numbered from 1 to 159.  In order to obtain the best disc performance
  163. the following logical to physical track mapping is performed.
  164.  
  165.         Logical CP/M            Physical
  166.         track                   track
  167.  
  168.         0-79                    0-79  (top surface)
  169.         80-159                  79-0  (bottom surface)
  170.  
  171. The first 3 tracks on the top surface are reserved for the CP/M system.
  172.  
  173. The CP/M directory starts at track 3 sector 0 and uses 4K bytes to allow up
  174. to 128 directory entries/disc.  This leaves 388K bytes/disc available for
  175. user programs and data.
  176.  
  177. Acorn CP/M uses deblocking to allow the physical disc sector size to be
  178. larger than the logical CP/M record size of 128 bytes.  Although a 256 byte
  179. sector size is used the effective sector size is 512 bytes as all disc
  180. operations read or write 2 sectors at a time using an appropriate sector
  181. skew.  The following table defines the logical record to physical sector
  182. relationship.
  183.  
  184.         Logical CP/M            Logical disc            Physical disc
  185.         record (128 bytes)      sector (512 bytes)      sector (256 bytes)
  186.     
  187.         0                        0                       0
  188.         1                        0                       0
  189.         2                        0                       1
  190.         3                        0                       1
  191.         4                        1                       4
  192.         5                        1                       4
  193.         6                        1                       5
  194.         7                        1                       5
  195.         8                        2                       8
  196.         9                        2                       8
  197.         10                       2                       9
  198.         11                       2                       9
  199.         12                       3                       2
  200.         13                       3                       2
  201.         14                       3                       3
  202.         15                       3                       3
  203.         16                       4                       6
  204.         17                       4                       6
  205.         18                       4                       7
  206.         19                       4                       7
  207.  
  208. The IOBYTE Facility
  209.  
  210. The CP/M operating system allows the user to redirect the input and output
  211. of its logical devices to particular physical devices.  As an example the
  212. CP/M system could be used with a remote terminal by assigning the physical
  213. device TTY:  (the RS423 serial port) to the logical device CON:  (the system
  214. console).
  215.  
  216. The use of the IOBYTE to reassign the physical devices is covered in the
  217. Digital Research CP/M Operating System Manual.
  218.  
  219. Care has been taken however to allow the user familiar with the BBC micro to
  220. use OSBYTE calls to redirect input and output as required.  This has been
  221. done by providing the physical device UC1: which uses the normal BBC micro
  222. IO streams.  These can be altered as required.  The default setting of the
  223. IOBYTE assigns the UC1: device to CON: so the system console behaves like a
  224. normal BBC micro.
  225.  
  226. The CP/M logical devices are as follows:
  227.  
  228. CON: is the principal interactive console that communicates with the
  229. operator and is accessed through CP/M calls to the Console.
  230.  
  231. LST: is the principal listing device, usually a printer.
  232.  
  233. PUN: is the tape punching device - the name is a leftover from the days when computers used paper tape.
  234.  
  235. RDR: is the tape reading device.  As with PUN: above it is inherited from
  236. the early version of CP/M.
  237.  
  238. The Acorn CP/M system implements the following physical devices which are
  239. used in conjunction with the above logical devices:
  240.  
  241. UC1: is the normal BBC Micro IO channel.  This allows the user familiar with
  242. the BBC to redirect IO without using the CP/M IOBYTE.  It also supports the
  243. terminal emulation facility described elsewhere.
  244.  
  245. CRT: provides direct access to the BBC screen and keyboard.  Unlike the UC1:
  246. device input and output cannot be redirected by OSBYTE calls.  Input always
  247. comes from the keyboard and output always goes to the screen.  It does not
  248. support the terminal emulation facility.
  249.  
  250. TTY: is the RS423 serial port.  The default baud rate is 9600.  It can be
  251. used for both input and output.  Please note that the user should not
  252. disable the RS423 input if using the TTY: input device.  The default setting
  253. is input enabled.
  254.  
  255. LPT: is the standard BBC micro printer device.  This is a Centronics with no
  256. printer ignore character as a default but can be changed using OSBYTE calls. 
  257. If a printer is not present then attempts to send characters to the printer
  258. will cause a message 'Printer off line' to appear.  the user may then
  259. connect a printer and carry on.  Alternatively if a printer is not available
  260. after a short time the message 'SPACE starts Printer Sink' appears and the
  261. user can press the SPACE bar to throw away the printer output.  The printer
  262. sink is detailed in the BBC Micro users Guide.  Characters sent to the
  263. printer will continue to be ignored until the user selects another printer
  264. type with a *FX5 call.
  265.  
  266. UL1: is the same as the LPT: device except no messages appear if the printer isn't connected.  The system will simply stop.
  267.  
  268. NUL: is a device which throws sway all output and returns 1Ah on input,
  269. indicating End of file.  This is present to prevent the system hanging if an
  270. unimplemented physical device is selected.
  271.  
  272. UR1:, UR2:, UP1:, UP2: are all equivalent to the NUL: device.
  273.  
  274. The default value for the IOBYTE in the Acorn CP/M system is 83h.  This
  275. assigns UC1: to CON:, LTP: to LST:, TTY: to RDR:, and TTY: to PUN:.
  276.  
  277. This can be changed by applications programs or by the STAT command.
  278.  
  279.  
  280. The System Patch Area
  281.  
  282. To allow temporary patches to be made to the Acorn CP/M system an area has
  283. been reserved in the BIOS.  It starts immediately after the SECTRAN entry
  284. point in the CP/M BIOS jump table and is 60h bytes long.  this is EA33h to
  285. EA92h inclusive in the current acorn CP/M system.  Please note this may
  286. alter in future systems.
  287.  
  288. Patching should only be attempted by those familiar with the CP/M system.
  289.  
  290. There are two main types of patch:
  291.  
  292. The first is to add special initialisation code.  The instructions at EA33h
  293. is a RET.  This location is called at cold start which allows a special
  294. subroutine to be inserted in place of the RET.  This could for example
  295. select a serial printer as default.
  296.  
  297. The other use is to patch in temporary additions to the system.  Certain
  298. applications programs do so.  Please note that patches of this sort may be
  299. overwritten by other programs.  As a result they can only form temporary
  300. additions to the system and they should 'tidy up' on termination, ie any
  301. changes made to other parts of the operating system should be reversed after
  302. the patch has done it's job.
  303.  
  304.  
  305.  
  306.